class Phase1 {
 
Path[] paths;
int displayW = 380;
int displayH = 550;
int xpos, ypos;
PImage brick_h, brick_v;
 
Phase1(){
 paths = new Path[5];
 brick_h = loadImage("brick_h.gif");
 brick_v = loadImage("brick_v.gif");
} 

void drawPath() {
  paths[0] = new Path(displayWidth - (int) (0.526*displayWidth), displayHeight - (int) (0.127 * displayHeight), (int) (0.526*displayWidth), (int) (0.091*displayHeight), "h4", brick_h );
  paths[1] = new Path(displayWidth - (int) (0.526*displayWidth), displayHeight - (int) (0.527*displayHeight), (int) (0.091*displayHeight), (int) (0.40*displayHeight), "v", brick_v);
  paths[2] = new Path(displayWidth - (int) (0.526*displayWidth), displayHeight - (int) (0.618*displayHeight), (int) (0.342*displayWidth), (int) (0.091*displayHeight), "h2", brick_h);
  paths[3] = new Path(displayWidth - (int) (0.185*displayWidth), displayHeight - (int) (0.873*displayHeight), -(int) (0.091*displayHeight), (int) (0.255*displayHeight), "v", brick_v);
  paths[4] = new Path(displayWidth - (int) (0.789*displayWidth), displayHeight - (int) (0.964*displayHeight), (int) (0.605*displayWidth), (int) (0.091*displayHeight), "h1", brick_h);
}

void collision(int xpos, int ypos, int animationHeight, int animationWidth) {
  this.xpos = xpos;
  this.ypos = ypos; 
  
  if(ypos > (displayHeight - (int) (0.127 * displayHeight)) -3) {
    paths[0].collision(xpos, ypos, animationHeight, animationWidth);}
  if(ypos > ((displayHeight -(int) (0.527*displayHeight))-3)) {
    if (ypos < ((displayHeight - (int) (0.127 * displayHeight)) -3))
      paths[1].collision(xpos, ypos, animationHeight, animationWidth);}
  if(ypos > ((displayHeight - (int) (0.618*displayHeight))-3)) {
    if(ypos < ((displayHeight - (int) (0.527*displayHeight)) -3))
      paths[2].collision(xpos, ypos, animationHeight, animationWidth);}
  if(ypos > ((displayHeight -(int) (0.872*displayHeight))-3))
    if(ypos < ((displayHeight - (int) (0.618*displayHeight)) -3))
      paths[3].collision(xpos, ypos, animationHeight, animationWidth);
  if(ypos > ((displayHeight -(int) (0.964*displayHeight))-3)) 
    if (ypos < ((displayHeight - (int) (0.872*displayHeight)) -3))
      paths[4].collision(xpos, ypos, animationHeight, animationWidth);
}

int[] getInputs() {
  if(ypos > (displayHeight - (int) (0.127 * displayHeight)) -3){ 
    return paths[0].getInputs(); }
  else if(ypos > ((displayHeight - (int) (0.527*displayHeight)) -3)) {
    if(ypos < ((displayHeight - (int) (0.127 * displayHeight)) -3))
    return paths[1].getInputs(); }
  else if(ypos > ((displayHeight - (int) (0.618*displayHeight)) -3)) {
    if(ypos < ((displayHeight - (int) (0.527*displayHeight)) -3))
    return paths[2].getInputs(); }
  else if(ypos > ((displayHeight - (int) (0.872*displayHeight)) -3)) {
    if(ypos < ((displayHeight - (int) (0.618*displayHeight)) -3))
    return paths[3].getInputs(); }
  else if(ypos > ((displayHeight - (int) (0.964*displayHeight)) -3)) {
    if (ypos < ((displayHeight - (int) (0.872*displayHeight)) -3))
    return paths[4].getInputs(); }
  return paths[4].getInputs();
}

}


